package com.tulun.job;

import com.tulun.utils.DateUtils;
import org.quartz.Job;
import org.quartz.JobDataMap;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;

import java.text.SimpleDateFormat;

/**
 * desc:压缩/解压缩服务job
 * @user:gongdezhe
 * @date:2018/8/19
 */

public class CompressJob implements Job {
    @Override
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        JobDataMap jobDataMap = jobExecutionContext.getJobDetail().getJobDataMap();
        String dateTime = DateUtils.getDateTime();
        String path = (String)jobDataMap.get("path");
        boolean isCompress = (boolean)jobDataMap.get("isCompress");
//        System.out.println(" 是否压缩:"+isCompress+ " 路径:"+path);

        //
        if (isCompress) {
            //压缩服务
            //do someThing
        } else {
            //解压服务
            //do someThing
        }

        System.out.println("时间："+dateTime+" CompressJob:当前线程："+Thread.currentThread());
     }

}
